﻿using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Configuration;
namespace PH_Zu_DataUpload_Auto.Properties
{
    class Mysql
    {

        public MySqlConnection sqlConnection = null;
        public Mysql()
        {
            String Server = ConfigurationManager.AppSettings["Server"].ToString();
            String UserID = ConfigurationManager.AppSettings["UserID"].ToString();
            String Password = ConfigurationManager.AppSettings["Password"].ToString();
            String Database = ConfigurationManager.AppSettings["Database"].ToString();

            // 创建数据库连接
            string Str = "server={0};user={1};database={2};port=3306;password={3};";
            string connStr = string.Format(Str, Server, UserID, Database,Password);
            sqlConnection = new MySqlConnection(connStr);

            // 打开连接
            sqlConnection.Open();

        }
    }
}
